<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateReceiptCodeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('receipt_code', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();

            $table->integer('order_id')->unsigned()->unique()->comment('订单id');

            $table->string('code')->unique()->comment('取货码');

            $table->integer('user_id')->unsigned()->comment('用户id');

            $table->timestamp('get_time')->comment('提货时间');

        });
        DB::statement("ALTER TABLE `receipt_code` COMMENT='取货码表'");//表注释


        Schema::table('order', function (Blueprint $table) {
            //
            $table->integer('status')->unsigned()
                ->comment('1待付款，11已支付，22已取消,30已完成')->change();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('receipt_code');

        Schema::table('order', function (Blueprint $table) {
            //
            $table->integer('status')->unsigned()
                ->comment('1待付款，11已支付，22已取消')->change();
        });

    }
}
